<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>

    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css"> 
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script> 
    
    <%@ include file="/WEB-INF/JSP/backHome/modalWindows/departmentListPage.jsp" %> 
    <%@ include file="/WEB-INF/JSP/backHome/modalWindows/personsListPage.jsp" %> 
        
    <style type="text/css">
        .seachform li label {
            line-height: 45px;
            color: #444444
        }

        .scinput {
            line-height: 10px;
            margin-top: 5px
        }

        .scinput1 {
            margin-top: 5px;
            height: 30px;
        }

        .scbtn2 {
            height: 20px;
            background: #57a0ff;
            border-radius: 20px;
            width: 50px;
            color: #fff;
            display: none;
        }

        thead {
            background: #f2f2f2
        }

        tbody tr:nth-child(even) {
            background: #f7f8fd
        }

        tbody tr {
            height: 38px
        }

        .check {
            padding-left: 0px
        }

        a {
            cursor: pointer;
        }

        #table1 tr th {
            height: 20px;
            border-bottom: 1px solid #bbb;
            border-top: 1px solid #bbb;
            border-left: 1px solid #bbb;
            border-right: 1px solid #bbb
        }

        .template tr td {
            border: solid 1px #ccc;
            font-size: 12px;
        }

        .template tr th {
            font-size: 14px;

        }

        .scinput {
            line-height: 10px;
            margin-top: 5px
        }

        .scinput1 {
            margin-top: 5px;
            height: 30px;
        }

        thead {
            background: #f2f2f2
        }

        .template th {
            height: 45px;
            background: none;
        }

        .template tr {
            height: 45px;
        }

        .template tr th {
            height: 20px;
            border-left: 1px solid #dddee6;
            border-right: 1px solid #dddee6;
            color: #444444;
            text-align: center;
        }

        .tou {
            background: #e4eafe
        }

        .kh {
            border-bottom: 1px solid #dddee6;
        }

        .shuju td {
            border: 1px solid #dddee6;
            color: #787c88;
            text-align: center;
        }

        .shuju:nth-child(odd) {
            background: #ffffff
        }

        .shuju:nth-child(even) {
            background: #f3f5fb
        }

        .shuju:last-child {
            border-bottom: 1px solid #dddee6;
        }

        .shuju:HOVER {
            background: #fff6cd;
        }

        ul {
            border: none;
        }

        .seachform li label {
            line-height: 45px;
            color: #444444
        }

        .scbtn {
            background: #57a0ff;
            border-radius: 20px;
            width: 110px;
            height: 35px;
            margin-left: 40px;
            font-size: 14px;
            font-weight: bold;
            color: #fff;
            cursor: pointer;
            outline: none;
            border: none;
        }

        thead {
            background: #f2f2f2
        }

        tbody tr:nth-child(even) {
            background: #f7f8fd
        }

        .tablelist th {
            height: 45px;
            text-align: center;
            background: none;
            border-bottom: none;
        }

        .tablelist td {
            border-right: none;
            text-align: center;
        }

        tbody tr {
            height: 38px
        }

        a {
            cursor: pointer;
        }

        .placeul a {
            color: #444444
        }

        .success td {
            border: 1px solid #111
        }

        .seachform {
            display: block;
            list-style-type: disc;
            -webkit-margin-before: 1em;
            -webkit-margin-after: 1em;
            -webkit-margin-start: 0px;
            -webkit-margin-end: 0px;
            -webkit-padding-start: 40px;
        }

        .seachform {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
            border-bottom: none
        }

        .rightinfo {
            padding: 8px;
            font-size: 12px
        }

        a, a:focus {
            text-decoration: none;
            color: #000;
            outline: none;
            blr: expression(this.onFocus=this.blur());
        }

        .seachform li {
            float: left;
            margin-right: 15px;
        }

        li {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .placeul li:last-child {
            background: none;
        }

        .seachform li label {
            margin-right: 10px
        }

        .placeul li {
            float: left;
            line-height: 40px;
            padding-left: 7px;
            padding-right: 12px;
            background: url(../images/rlist.gif) no-repeat right;
            font-size: 9px
        }

        ul {
            border-bottom: none;
        }
    </style>
</head>
<body style="background: #f5f5f5;padding: 0 10px;">
<div class="place" style="background: #f5f5f5; margin-top: 10px">
    <ul class="placeul">
        <li><a href="#">报表</a></li>
        <li><a href="#">管理报表</a></li>
        <li><a href="<%=path%>/DrivingSys/queryRecruitStudentJournal/look.action">招生统计报表</a></li>
    </ul>
</div>

<div class="rightinfo"
     style="background: #fff; border-radius: 10px; height: 45px;">

    <form action="<%=path%>/DrivingSys/queryRecruitStudentJournal/look.action" method="post">
        <ul class="seachform" >      	
            <li><label>开始时间</label><input class="scinput1" name="beginTime"
                                          type="text"
                                          onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',dateFmt:'yyyy-MM-dd'})"
                                          id="datemin" class="input-text Wdate" style="width: 150px;"
                                          value="${beginTime}"></li>
            <li><label>结束时间</label><input class="scinput1" name="endTime"
                                          type="text"
                                          onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})"
                                          id="datemax" class="input-text Wdate" style="width: 150px;"
                                          value="${endTime}"></li>
            <li><label>人员</label><input class="scinput1" name="person"
                                        type="text" class="input-text Wdate" style="width: 150px;"
                                        value="${person }" id="person"></li>
            <li><label>部门</label><input class="scinput1" name="deparment"
                                        type="text" class="input-text Wdate" style="width: 150px;"
                                        value="${deparment }" id="deparment"></li>
            <li><label>&nbsp;</label><input name="" type="submit"
                                            class="scbtn" value="立即查询"/></li>
            <shiro:hasPermission name="/outXlsRecruitStudent">
                <li><label>&nbsp;</label><input name="" type="button" id="dc"
                                                class="scbtn" value="导出Excel" /></li>
            </shiro:hasPermission>
        </ul>
    </form>
</div>
<form action="<%=path%>/DrivingSys/outXls" method="post" id="outXls">
    <input id="xls" type="hidden" name="xls" value="">
    <input type="hidden" name="fileNames" value="${beginTime } 至 ${endTime}招生统计报表">
</form>

<div style="width: 100%; overflow: auto; margin-top: 30px; background: #fff; box-shadow: 0 0 10px #f2f2f2; min-height: 600px;"
     class="info">
    <table class="template tablelist" style="width: 1200px; border-spacing: 0px" align="center">
        <tr class="tou">
            <th style="text-align: center; width: 5px"></th>
            <th colspan="12" style="text-align: center; font-size: 18px; ">${beginTime}至${endTime} ${subject } 招生统计</th>
        </tr>
        <tr class="tou">
            <th style="text-align: center; width: 5px"></th>
            <th style="text-align: center; width: 20px">部门</th>
            <th style="text-align: center; width: 15px">人员</th>
            <th style="text-align: center; width: 20px">班级</th>
            <th style="text-align: center; width: 10px">本月(不含未交费、特招、特批)</th>
            <th style="text-align: center; width: 10px">以前入学本月交费</th>
            <th style="text-align: center; width: 10px">转班</th>
            <th style="text-align: center; width: 10px">特招</th>
            <th style="text-align: center; width: 10px">特批</th>
            <th style="text-align: center; width: 10px">已交费小计</th>
            <th style="text-align: center; width: 10px">未交费</th>
            <th style="text-align: center; width: 10px">合计</th>
            <th style="text-align: center; width: 10px">退学</th>
        </tr>
		<c:forEach items="${recruitStudentJournalList }" var="recruitStudentJournal" varStatus="status">
			<tr class="shuju">
				<td style="text-align: center; width: 5px" class="xuhao"></td>
				<td style="text-align: center; width: 20px">${recruitStudentJournal.departmentName }</td>
                <td style="text-align: center; width: 15px">${recruitStudentJournal.personName }</td>
                <td style="text-align: center; width: 20px">${recruitStudentJournal.className }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.nowMonthCount }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.agoMonthCount }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.changeClassCount }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.particularCount1 }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.particularCount2 }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.payedCount }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.notPayCount }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.sum }</td>
                <td style="text-align: center; width: 10px">${recruitStudentJournal.dropOutCount }</td>
			</tr>
        </c:forEach>
    </table>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript">
    $(document).ready(function () {
        function _w_table_rowspan(_w_table_id, _w_table_colnum) {
            _w_table_firsttd = "";//需要合并的第一行
            _w_table_currenttd = "";//当前行
            _w_table_SpanNum = 0;//相同的行数
            var now_month = 0;//本月数量统计
            var now_month_department = 0;//本月数量统计 部门
            var ago_month = 0;//以前入学本月交费数量统计
            var ago_month_department = 0;//以前入学本月交费数量统计 部门
            var change_class = 0;//转班
            var change_class_department = 0;//转班 部门
            var particular1 = 0;//特招
            var particular1_department = 0;//特招 部门
            var particular2 = 0;//特批
            var particular2_department = 0;//特批 部门
            var payed = 0;//已交小费
            var payed_department = 0;//已交小费 部门
            var nopay = 0;//未交
            var nopay_department = 0;//未交 部门
            var sum = 0;//合计
            var sum_department = 0;//合计 部门
            var dropOut = 0;//退学
            var dropOut_department = 0;//退学 部门
            var length = $(_w_table_id).find('tr').length//表格的长度
            _w_table_Obj = $(_w_table_id + " tr td:nth-child(" + _w_table_colnum + ")");
            //需要增加的人员小计行
            _w_table_Obj.each(function (i) {
                //计算部门的小计
                if ($(this).next().text() == '小计') {

                    now_month_department += Number($(this).next().parent().find("td:nth-child(5)").text())//本月

                    ago_month_department += Number($(this).next().parent().find("td:nth-child(6)").text())//以前入学本月交费

                    change_class_department += Number($(this).next().parent().find("td:nth-child(7)").text())//转班

                    particular1_department += Number($(this).next().parent().find("td:nth-child(8)").text())//特招

                    particular2_department += Number($(this).next().parent().find("td:nth-child(9)").text())//特批

                    payed_department += Number($(this).next().parent().find("td:nth-child(10)").text())//已交小费

                    nopay_department += Number($(this).next().parent().find("td:nth-child(11)").text())//未交

                    sum_department += Number($(this).next().parent().find("td:nth-child(12)").text())//合计

                    dropOut_department += Number($(this).next().parent().find("td:nth-child(13)").text())//退学
                }
                if (i == 0) {
                    _w_table_firsttd = $(this);
                    _w_table_SpanNum = 1;
                } else {
                    _w_table_currenttd = $(this);
                    if (_w_table_SpanNum == 1) {
                        var temp_now = _w_table_firsttd.parent().find("td:nth-child(5)").text()//本月
                        if (temp_now == null || temp_now == '') {
                            temp_now = 0;
                        }
                        now_month = Number(temp_now)
                        var temp_ago = _w_table_firsttd.parent().find("td:nth-child(6)").text()//以前入学本月交费
                        if (temp_ago == null || temp_ago == '') {
                            temp_ago = 0;
                        }
                        ago_month = Number(temp_ago)
                        var temp_class = _w_table_firsttd.parent().find("td:nth-child(7)").text()//转班
                        if (temp_class == null || temp_class == '') {
                            temp_class = 0;
                        }
                        change_class = Number(temp_class)
                        var temp_particular1 = _w_table_firsttd.parent().find("td:nth-child(8)").text()//特招
                        if (temp_particular1 == null || temp_particular1 == '') {
                            temp_particular1 = 0;
                        }
                        particular1 = Number(temp_particular1)
                        var temp_particular2 = _w_table_firsttd.parent().find("td:nth-child(9)").text()//特批
                        if (temp_particular2 == null || temp_particular2 == '') {
                            temp_particular2 = 0;
                        }
                        particular2 = Number(temp_particular2)
                        var temp_payed = _w_table_firsttd.parent().find("td:nth-child(10)").text()//已交小费
                        if (temp_payed == null || temp_payed == '') {
                            temp_payed = 0;
                        }
                        payed = Number(temp_payed)
                        var temp_nopay = _w_table_firsttd.parent().find("td:nth-child(11)").text()//未交
                        if (temp_nopay == null || temp_nopay == '') {
                            temp_nopay = 0;
                        }
                        nopay = Number(temp_nopay)
                        var temp_sum = _w_table_firsttd.parent().find("td:nth-child(12)").text()//未交
                        if (temp_sum == null || temp_sum == '') {
                            temp_sum = 0;
                        }
                        sum = Number(temp_sum)
                        var temp_dropOut = _w_table_firsttd.parent().find("td:nth-child(13)").text()//未交
                        if (temp_dropOut == null || temp_dropOut == '') {
                            temp_dropOut = 0;
                        }
                        dropOut = Number(temp_dropOut)

                    }
                    if (_w_table_firsttd.text() == _w_table_currenttd.text()) {
                        var temp_now = _w_table_currenttd.parent().find("td:nth-child(5)").text()//本月
                        if (temp_now == null || temp_now == '') {
                            temp_now = 0;
                        }
                        now_month += Number(temp_now)
                        var temp_ago = _w_table_currenttd.parent().find("td:nth-child(6)").text()//以前入学本月交费
                        if (temp_ago == null || temp_ago == '') {
                            temp_ago = 0;
                        }
                        ago_month += Number(temp_ago)
                        var temp_class = _w_table_currenttd.parent().find("td:nth-child(7)").text()//转班
                        if (temp_class == null || temp_class == '') {
                            temp_class = 0;
                        }
                        change_class += Number(temp_class)
                        var temp_particular1 = _w_table_currenttd.parent().find("td:nth-child(8)").text()//特招
                        if (temp_particular1 == null || temp_particular1 == '') {
                            temp_particular1 = 0;
                        }
                        particular1 += Number(temp_particular1)
                        var temp_particular2 = _w_table_currenttd.parent().find("td:nth-child(9)").text()//特批
                        if (temp_particular2 == null || temp_particular2 == '') {
                            temp_particular2 = 0;
                        }
                        particular2 += Number(temp_particular2)
                        var temp_payed = _w_table_currenttd.parent().find("td:nth-child(10)").text()//已交小费
                        if (temp_payed == null || temp_payed == '') {
                            temp_payed = 0;
                        }
                        payed += Number(temp_payed)
                        var temp_nopay = _w_table_currenttd.parent().find("td:nth-child(11)").text()//未交
                        if (temp_nopay == null || temp_nopay == '') {
                            temp_nopay = 0;
                        }
                        nopay += Number(temp_nopay)
                        var temp_sum = _w_table_currenttd.parent().find("td:nth-child(12)").text()//未交
                        if (temp_sum == null || temp_sum == '') {
                            temp_sum = 0;
                        }
                        sum += Number(temp_sum)
                        var temp_dropOut = _w_table_currenttd.parent().find("td:nth-child(13)").text()//未交
                        if (temp_dropOut == null || temp_dropOut == '') {
                            temp_dropOut = 0;
                        }
                        dropOut += Number(temp_dropOut)
                        _w_table_SpanNum++;
                        _w_table_currenttd.remove(); //remove();
                        _w_table_firsttd.attr("rowSpan", _w_table_SpanNum);
                    } else {
                        var str = '';//需要添加的行
                        if (_w_table_colnum == 3) {
                            str = '<tr><td style="text-align: center; width:5px" class="xuhao"></td>'
                            str += '<td style="text-align: center; width: 20px; background: rgb(255,255,216);font-weight:bold;" >' + _w_table_firsttd.prev().html() + '</td>'
                            str += '<td style="text-align: center; width: 15px;background: rgb(255,255,216);font-weight:bold;" >小计</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + now_month + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + ago_month + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + change_class + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + particular1 + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + particular2 + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;">' + payed + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + nopay + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + sum + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + dropOut + '</td></tr>'

                        }
                        if (_w_table_colnum == 2) {
                            str = '<tr><td style="text-align: center; width:5px" class="xuhao"></td>'
                            str += '<td style="text-align: center; width: 20px; background: rgb(240,230,140);font-weight:bold;" >小计</td>'
                            str += '<td style="text-align: center; width: 15px; background: rgb(240,230,140);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="now_month_department">' + now_month_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="ago_month_department">' + ago_month_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="change_class_department">' + change_class_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="particular1_department">' + particular1_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="particular2_department">' + particular2_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="payed_department">' + payed_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="nopay_department">' + nopay_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="sum_department">' + sum_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="dropOut_department">' + dropOut_department + '</td></tr>'
                            //num_department=0;//一个部门统计结束后清空数量
                            //把每次合并完后的部门数据统计清零
                            now_month_department = 0;
                            ago_month_department = 0;
                            change_class_department = 0;
                            particular1_department = 0;
                            particular2_department = 0;
                            payed_department = 0;
                            nopay_department = 0;
                            sum_department = 0;
                            dropOut_department = 0;
                        }
                        $(this).parent().prev().after(str)
                        _w_table_firsttd = $(this);
                        _w_table_SpanNum = 1;
                    }

                    if (i == length - 3) {
                        var str = '';//需要添加的行
                        if (_w_table_colnum == 3) {
                            str = '<tr><td style="text-align: center; width:5px" class="xuhao"></td>'
                            str += '<td style="text-align: center; width: 20px; background: rgb(255,255,216);font-weight:bold;" >' + _w_table_firsttd.prev().html() + '</td>'
                            str += '<td style="text-align: center; width: 15px;background: rgb(255,255,216);font-weight:bold;" >小计</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + now_month + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + ago_month + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + change_class + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + particular1 + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + particular2 + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + payed + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + nopay + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + sum + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(255,255,216);font-weight:bold;" >' + dropOut + '</td></tr>'
                        }
                        if (_w_table_colnum == 2) {
                            str = '<tr><td style="text-align: center; width:5px" class="xuhao"></td>'
                            str += '<td style="text-align: center; width: 20px; background: rgb(240,230,140);font-weight:bold;" >小计</td>'
                            str += '<td style="text-align: center; width: 15px; background: rgb(240,230,140);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" ></td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="now_month_department">' + now_month_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="ago_month_department">' + ago_month_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="change_class_department">' + change_class_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="particular1_department">' + particular1_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="particular2_department">' + particular2_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="payed_department">' + payed_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="nopay_department">' + nopay_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="sum_department">' + sum_department + '</td>'
                            str += '<td style="text-align: center; width: 10px; background: rgb(240,230,140);font-weight:bold;" class="dropOut_department">' + dropOut_department + '</td></tr>'
                        }
                        $(_w_table_id).append(str)
                    }

                }

            });


        }

        _w_table_rowspan(".template", "3")
        _w_table_rowspan(".template", "2")
        //统计总计数量
        var now_month_all = 0;
        var ago_month_all = 0;
        var change_class_all = 0;
        var particular1_all = 0;
        var particular2_all = 0;
        var payed_all = 0;
        var nopay_all = 0;
        var sum_all = 0;
        var dropOut_all = 0;
        $(".now_month_department").each(function (i) {
            now_month_all += Number($(this).text());
        })
        $(".ago_month_department").each(function (i) {
            ago_month_all += Number($(this).text());
        })
        $(".change_class_department").each(function (i) {
            change_class_all += Number($(this).text());
        })
        $(".particular1_department").each(function (i) {
            particular1_all += Number($(this).text());
        })
        $(".particular2_department").each(function (i) {
            particular2_all += Number($(this).text());
        })
        $(".payed_department").each(function (i) {
            payed_all += Number($(this).text());
        })
        $(".nopay_department").each(function (i) {
            nopay_all += Number($(this).text());
        })
        $(".sum_department").each(function (i) {
            sum_all += Number($(this).text());
        })
        $(".dropOut_department").each(function (i) {
            dropOut_all += Number($(this).text());
        })
        var str = '';
        str = '<tr><td style="text-align: center; width:5px" class="xuhao"></td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" >总计</td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" ></td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" ></td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" >' + now_month_all + '</td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" >' + ago_month_all + '</td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" >' + change_class_all + '</td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" >' + particular1_all + '</td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" >' + particular2_all + '</td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" >' + payed_all + '</td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" >' + nopay_all + '</td>'
        str += '<td style="text-align: center; width: 10px; background: rgb(255,215,0);font-weight:bold;" >' + sum_all + '</td>'
        str += '<td style="text-align: center; width: 20px; background: rgb(255,215,0);font-weight:bold;" >' + dropOut_all + '</td></tr>'

        $(".template").append(str);
        //处理序号
        $(".xuhao").each(function (i) {
            $(this).html(i + 1)
        })

    })

    $("#dc").click(function () {
        //$(".template tr td:nth-child(1)").remove()
        //$(".template tr th:nth-child(1)").remove()
        var tableHtml = $(".info").html()

        $("#xls").val(tableHtml)
        //alert($("#xls").val())
        $("#outXls").submit();

    })
    //弹出部门框
    var deparment;
    $('#deparment').click(function (e) {
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data6').css('visibility', 'visible')
        $('input:checkbox').removeAttr('checked');
        deparment = $(this);
    })
     //单击部门
 	$(".xysj td").live('click',function(){
    	$('input:checkbox[name=train3]:checked').each(function(i) {
    	$(this).removeAttr("checked");
     	});
       	$(this).parent().find("input:checkbox[name=train3]").attr('checked','checked');
  	}) 
  	//双击确定部门
  	$(document).on('dblclick','.xysj td',function(){
  		var deparmentName=$(this).parent().find("td:nth-child(3)").text();
  		//alert(deparmentName)
		if(deparment !=null){
			deparment.val(deparmentName)
		}
		$('#modal-overlay').css('visibility', 'hidden')        
        $('.modal-data6').css('visibility', 'hidden')
        $('input:checkbox').removeAttr('checked');
        deparment=null;
	})
	//确认部门
	$(".subtn").click(function(){
		var deparmentName;
		 $('input:checkbox[name=train3]:checked').each(function (i) {		 
			deparmentName = $(this).parent().parent().find("td:nth-child(3)").text();			   
		 });
	 if(deparmentName == null ){
		 alert("请勾选需要选中的行！")
		 return false;
	 }
	 deparment.val(deparmentName);
	 $('#modal-overlay').css('visibility', 'hidden')        
     $('.modal-data6').css('visibility', 'hidden')
     $('input:checkbox').removeAttr('checked');
	 deparment=null;
	})
    //弹出职员框
    var person;
    $("#person").click(function(i){
    	$('#modal-overlay').css('visibility', 'visible')
        $('.modal-data3').css('visibility', 'visible')
        $('input:checkbox').removeAttr('checked');
    	person =$(this);
    })
    //双击确定职员
  	$(document).on('dblclick','.jx td',function(){
  		var personName=$(this).parent().find("td:nth-child(3)").text(); 		
		if(person !=null){
			person.val(personName)
		}
		$('#modal-overlay').css('visibility', 'hidden')        
        $('.modal-data3').css('visibility', 'hidden')
        $('input:checkbox').removeAttr('checked');
        person=null;
	})
	//确认职员
	$(".subtn3").click(function(){
		var personName;
		 $('input:checkbox[name=person]:checked').each(function (i) {	
			personName = $(this).parent().parent().find("td:nth-child(3)").text();
		 });
	 if(personName == null ){
		 alert("请勾选需要选中的行！")
		 return false;
	 }
	 person.val(personName);
	 $('#modal-overlay').css('visibility', 'hidden')        
     $('.modal-data3').css('visibility', 'hidden')
     $('input:checkbox').removeAttr('checked');
     person=null;
	})
    //关闭摸态框
    $(".btn").click(function () {
        $('#modal-overlay').css('visibility', 'hidden')
        $('.modal-data1').css('visibility', 'hidden')
        $('.modal-data2').css('visibility', 'hidden')
        $('.modal-data3').css('visibility', 'hidden')
        $('.modal-data4').css('visibility', 'hidden')
        $('.modal-data5').css('visibility', 'hidden')
        $('.modal-data6').css('visibility', 'hidden')
        $('input:checkbox').removeAttr('checked');
        deparment=null;
        person=null;
    })
</script>
</html>